package com.sulent.frame.web.config;

import io.netty.util.concurrent.DefaultThreadFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * @ClassName SubThreadPoolConfig
 * @Description: TODO
 * @Author Submerge.
 * @Since 2025/3/19 18:56
 * @Version 1.0
 */
@Configuration
public class SubThreadPoolConfig {

    @Bean
    public ExecutorService threadPoolExecutor (){
        ThreadFactory threadFactory = new DefaultThreadFactory("sub-thread-pool");

        RejectedExecutionHandler handler = new ThreadPoolExecutor.AbortPolicy();


        return new ThreadPoolExecutor(1, 2, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), threadFactory, handler);
    }
}
